﻿var flag = "";
//初始化
if (typeof ($) != "undefined") {
    $(document).ready(function () {
        //alert("postid:" + getPar1("PostID"))
        flag = getPar1("flag");
        var CategoryID = getPar1("CategoryID");
        var CategoryName = decodeURI(getPar1("CategoryName"));
        if (flag == "add") {
            $("#CategoryID").val(CategoryID)
            $("#Category").val(CategoryName);
        }
    });
    instance[0].ModifyTime = new Date();
}

var fnCheckData = function () {
    try {
        if ($("#Caption").val() == "") {
            return "【技能名称】不能为空!";
        }
        if ($("#Require").val() == "") {
            return "【技能要求】不能为空!";
        }
        if ($("#CategoryID").val() == "") {
            return "【所属分类】不能为空!";
        }
        if ($("#Level").val() == "") {
            return "【级别级数】不能为空!";
        }
        var reg = /^\+?[1-9][0-9]*$/;
        if (reg.test($("#Level").val()) == false) {
            return "【级别级数】需要输入正整数!";
        }

    }
    catch (e)
     { }
}

 //校验子表的层级字段
 var CheckDataLevel = function (obj) {
     var reg = /^\+?[1-9][0-9]*$/;
     var row = getTableRow(obj);
     var Level = $("#Level", row).val();
     if (reg.test(Level) == false) {
         alert("【级别】需要输入正整数!");
         $("#Level", row).focus();
         return;
     }
 }